package com.studyv3.test.controller.Todo;

import com.studyv3.common.core.domain.R;
import com.studyv3.test.domain.ApplyProduct;
import com.studyv3.test.domain.Batch;
import com.studyv3.test.entity.TodoQuery;
import com.studyv3.test.service.TodoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * @author: 作者
 * @create: 2024-05-07 19:47
 * @Description:
 */
@RestController
@RequestMapping("/todo")
public class TodoController {

   @Resource
   private TodoService todoService;
    @GetMapping("pageProduct")
    public R pageProductTodo(TodoQuery query) throws ParseException {
        return todoService.queryPageProductTodo(query);
    }

    @PostMapping("getProductTodoByBatchId")
    public R getProductTodoByBatchId(@RequestBody Map<String,Integer> map){
        return todoService.getProductTodoByBatchId(map.get("id"));
    }

    @PostMapping("getProductCompleteByBatchId")
    public R getProductCompleteByBatchId(@RequestBody Map<String,Integer> map){
        return todoService.getProductCompleteByBatchId(map.get("id"));
    }

    @PostMapping("agreeProduct")
    public R agreeProductTodo(@RequestBody Map<String, List<Integer>> map){
        return todoService.agreeProduct(map.get("id"));
    }

    @PostMapping("disagreeProduct")
    public R disagreeProductTodo(@RequestBody Map<String,List<Integer>> map){
        return todoService.disagreeProduct(map.get("id"));
    }

    @GetMapping("pageWaste")
    public R pageWasteTodo(TodoQuery query) throws ParseException {
        return todoService.queryPageWasteTodo(query);
    }

    @GetMapping("pageTake")
    public R pageTakeTodo(TodoQuery query) throws ParseException {
        return todoService.queryPageTakeTodo(query);
    }
}
